<template>
    <div class="demo">
        <h2>学生名字为：{{name}}</h2>
        <br/>
        <h2>学生年龄为：{{age}}</h2>
        <button @click="sendStudentName">将学生姓名给School组件</button>
    </div>
</template>

<script>
export default {
    name:'Student',
    data() {
        return {
            name:'张三',
            age:18
        }
    },
    methods:{
        sendStudentName(){
            this.$bus.$emit('hello',this.name)
        }
    }
}
</script>

<style scoped>
.demo{
    background-color: orange;
    padding: 5px;
}
</style>